package com.mySchool.controller;

import com.mySchool.anno.SysLog;
import com.mySchool.entity.*;
import com.mySchool.entity.DTO.*;
import com.mySchool.service.*;


import org.springframework.beans.factory.annotation.*;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
    * @author : sky
    * @date : 2024/9/19 下午8:34
    */
@RestController
public class CityController {
    @Autowired
    private CityService cityService;

    @PostMapping("/insert")
    @SysLog("新增城市")
    public Result insert(@RequestBody Request<CityInsertRequest> cityInsertRequest) {
        cityService.insert( cityInsertRequest.getParam());
        return Result.success();
    }

    @DeleteMapping
    @SysLog("删除城市")
    public Result delete(@RequestBody Request<List<Integer>> request) {
        cityService.delete(request.getParam());
        return Result.success();
    }

    @PutMapping("/update")
    @SysLog("更新城市")
    public Result update(@RequestBody Request<CityUpdateRequest> request) {
        cityService.update(request.getParam());
        return Result.success();
    }

    @GetMapping("queryHigher")
    public Result<PageResult<CityHigherQueryResponse>> queryHigher(@RequestBody Request<CityHigherQueryRequest> request) {
        PageResult<CityHigherQueryResponse> result = cityService.queryHigher(request.getParam());
        return Result.success(result);
    }

}




